<!--
 * @Author: fanyaqing
 * @Date: 2021-08-05 14:49:19
 * @LastEditTime: 2021-08-09 16:27:46
 * @LastEditors: fanyaqing
 * @Description: 
 * @FilePath: \supermall\src\views\home\childComponents\HomeSwiper.vue
-->
<template>
  <div>
    <swiper>
      <swiper-item v-for="(item, index) in banners" :key="index">
        <a :href="item.link">
          <img :src="item.image" @load="imageLoaded">
        </a>
      </swiper-item>
    </swiper>
  </div>
</template>
<script>
import {Swiper,SwiperItem} from 'components/common/swiper';

export default {
  props:{
    banners:{
      type:Array,
      default:()=>{
        return []
      }
    }
  },
  components:{
    Swiper,
    SwiperItem
  },
  data() {
    return {
      isLoading:false
    }
  },
  methods:{
    imageLoaded(){
      if(!this.isLoading){
        this.$emit('homeSwiperImgLoaded')
        this.isLoading=true;
      }
    }
  }
}
</script>
<style scoped>

</style>